<?php
$this->breadcrumbs=array(
	$type=>array('index', 'tid'=>$model->tid),
	$model->title=>array('view','id'=>$model->id),
	'更新',
);

$this->menu=array(
	
	array('label'=>'创建事件', 'url'=>array('create','tid'=>DefineBox::EVENT_TYPE_CODE)),
	array('label'=>'创建知识', 'url'=>array('create','tid'=>DefineBox::PEDIA_TYPE_CODE)),
	array('label'=>'创建地点', 'url'=>array('create', 'tid'=>DefineBox::SCENE_TYPE_CODE)),
	array('label'=>'创建角色', 'url'=>array('create', 'tid'=>DefineBox::ROLE_TYPE_CODE)),
	array('label'=>'创建物品', 'url'=>array('create', 'tid'=>DefineBox::OBJECT_TYPE_CODE)),
	array('label'=>'显示内容', 'url'=>array('view', 'id'=>$model->id)),
	array('label'=>'管理内容', 'url'=>array('admin')),
);

$this->category = HandleBox::getCategory();
?>

<h1>更新 <?php echo $model->title; ?></h1>

<?php 
// 链接映射
if ($nodeMapping){
	foreach ($nodeMapping as $node){
		switch ($node->snode->tid){
			case DefineBox::SCENE_TYPE_CODE:
				$virtual['scene'] .= $node->snode->title.',';
				break;
			case DefineBox::ROLE_TYPE_CODE:
				$virtual['role'] .= $node->snode->title.',';
				break;
			case DefineBox::OBJECT_TYPE_CODE:
				$virtual['object'] .= $node->snode->title.',';
				break;
			case DefineBox::PEDIA_TYPE_CODE:
				$virtual['pedia'] .= $node->snode->title.',';
				break;
		}
	}
$virtual['scene'] = substr($virtual['scene'], 0, -1);
$virtual['role'] = substr($virtual['role'], 0, -1);
$virtual['object'] = substr($virtual['object'], 0, -1);
$virtual['pedia'] = substr($virtual['pedia'], 0, -1);
}

// tag标签
if($tags){
	$tagString = '';
	foreach ($tags as $tag){
		$tagString .= $tag->tag.',';
	}
	$virtual['tag'] = substr($tagString, 0, -1);
}
?>

<?php echo $this->renderPartial('_form', array('model'=>$model, 'virtual'=>$virtual, 'cats'=>$cats)); ?>